package com.zzxx.www.web;

import com.zzxx.www.domain.User;
import com.zzxx.www.service.impl.UserServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet(name = "UserQueryServlet", value = "/UserQueryServlet")
public class UserQueryServlet extends HttpServlet {
	private UserServiceImpl userService = new UserServiceImpl();
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		List<User> userList = userService.queryAll();
		request.setAttribute("list",userList);
		request.getRequestDispatcher("/list.jsp").forward(request,response);
	}

	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doGet(request, response);
	}
}
